/**  
* @Title: MerchantStatController.java  
* @Description: TODO(用一句话描述该文件做什么)  
* @author 张鑫
* @phone 17561783855  
* @date 2019年8月2日  
*/
package com.fortune.rainshine.service.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fortune.rainshine.common.BaseController;
import com.fortune.rainshine.service.service.StatService;
import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.enums.ResultCode;
import com.fortune.rainshinecommon.query.StatQuery;

/**  
* @ClassName: MerchantStatController  
* @Description: TODO(这里用一句话描述这个类的作用)  
* @author 张鑫
* @phone 17561783855
* @date 2019年8月2日  
*    
*/
@Controller
@RequestMapping("/service/shopBuy")
public class ShopBuyStatController extends BaseController{
	private static final Logger logger = LoggerFactory.getLogger(ShopBuyStatController.class);
	@Autowired
    private StatService service;
	
	@RequiresPermissions("shopBuy:view")
	@RequestMapping()
	public String shopBuyStat(Model model) {
		return "stat/shopBuy.html";
	}
	
	@RequiresPermissions("shopBuy:view")
    @ResponseBody
    @RequestMapping("/shopBuy")
    public MsgModel shopBuyStatStatistics(@RequestBody StatQuery model) {
		try {
			model.setChannel("web");
	    	return service.shopBuy(model);
		} catch (Exception e) {
			logger.error("add ====> {}",e);
			return new MsgModel(ResultCode.FAILURE);
		}
    }

}
